﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;
 
public partial class ScoreInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CreateReport();
        }
    }
    /// <summary>
    /// 生成报表数据
    /// </summary>
    private void CreateReport()
    {
        int userid = 1;
        int.TryParse(Request.QueryString["userid"], out userid);
        //获取数据源
        DataTable dt = DBBLL.GetScoreInfo(userid);
        //设置是否允许报表展示图片 默认为false
        //RptView.LocalReport.EnableExternalImages = true;
        //设置报表路径
        RptView.LocalReport.ReportPath = "RDLC\\Report_Score.rdlc";
        //清空报表数据
        RptView.LocalReport.DataSources.Clear();
        //添加报表数据集  数据集的名称为报表控件中的集合名称
        RptView.LocalReport.DataSources.Add(new ReportDataSource("ds_score", dt));

       new ReportDataSource("",new List<string>());

          //  IDataSource



        //设置报表参数
        //SetReportParameters(this.RptView.LocalReport);

        //绑定报表
        RptView.DataBind();
    }
}